programming - windows - Button Notification MessagesWhat links here?
When the user clicks a button, its state changes, and the button sends notification messages to its parent window. For example, a push button control sends the BN_CLICKED notification message whenever the user chooses the button. In all cases (except for BCN_HOTITEMCHANGE), the low-order word of the wParam parameter contains the control identifier, the high-order word of wParam contains the notification code, and the lParam parameter contains the control window handle.

Both the message and the parent window's response depend on the type, style, and current state of the button. Following are the button notification messages an application should monitor and process.

MessageDescription
programming:windows:BCN_HOTITEMCHANGE Microsoft Windows XP: The mouse entered or left the client area of a button.
programming:windows:BN_CLICKED The user clicked a button.
programming:windows:BN_DBLCLK or programming:windows:BN_DOUBLECLICKED The user double-clicked a button.
programming:windows:BN_DISABLE A button is disabled.
programming:windows:BN_PUSHED or programming:windows:BN_HILITE The user pushed a button.
programming:windows:BN_KILLFOCUS The button lost the keyboard focus.
programming:windows:BN_PAINT The button should be painted.
programming:windows:BN_SETFOCUS The button gained the keyboard focus.
programming:windows:BN_UNPUSHED or programming:windows:BN_UNHILITE The button is no longer pushed.


A button sends the BN_DISABLE, BN_PUSHED, BN_KILLFOCUS, BN_PAINT, BN_SETFOCUS, and BN_UNPUSHED notification messages only if it has the BS_NOTIFY style. BN_DBLCLK notification messages are sent automatically for BS_USERBUTTON, BS_RADIOBUTTON, and BS_OWNERDRAW buttons. Other button types send BN_DBLCLK only if they have the BS_NOTIFY style. All buttons send the BN_CLICKED notification message regardless of their button styles.

For automatic buttons, the system changes the push state and paints the button. In this case, the application typically processes only the BN_CLICKED and BN_DBLCLK notification messages. For buttons that are not automatic, the application typically responds to the notification message by sending a message to change the state of the button. For information about sending messages to buttons, see Sending Messages to Buttons.

When the user selects an owner-drawn button, the button sends its parent window a WM_DRAWITEM message containing the identifier of the control to be drawn and information about its dimensions and state.
'''From WINUSER.H''':
 #define BN_CLICKED       0
 #define BN_PAINT         1
 #define BN_HILITE        2
 #define BN_PUSHED        2
 #define BN_UNHILITE      3
 #define BN_UNPUSHED      3
 #define BN_DISABLE       4
 #define BN_DBLCLK        5
 #define BN_DOUBLECLICKED 5
 #define BN_SETFOCUS      6
 #define BN_KILLFOCUS     7
programming - windows - Button Notification Messages
filename:programming - windows - Button Notification Messages
filename:programming%20%2D%20windows%20%2D%20Button%20Notification%20Messages
last edit:March 26 2010 19:31:14 (5153 days ago)
ct = 1714943846.000000 = May 05 2024 17:17:26
ft = 1269646274.000000 = March 26 2010 19:31:14
dt = 445297572.000000